#include <bits/stdc++.h>
using namespace std;
int main(){
    int n, sum = 0;
    cin >> n;
    for (int i = 1; i <= n; i++){
        char a;
        cin >> a;
        if (a >= 'a' && a <= 'z'){
            sum += a - 96;
        }
        else if(a >= 'A' && a <= 'Z'){
            sum += -1 * int(a);
        }
    }
    cout << sum;
    return 0;
}